package com.tsintergy.tmosguide.datamng.web.base.controller;

import com.tsieframework.core.base.web.BaseResp;
import com.tsieframework.core.base.web.BaseRespBuilder;
import com.tsintergy.tmosguide.datamng.core.DatamngConfigConstants;
import com.tsintergy.tmosguide.datamng.serviceapi.facade.api.DatamngFacadeService;
import com.tsintergy.tmosguide.datamng.serviceapi.facade.dto.AreaLoadFcDTO;
import com.tsintergy.tmosguide.datamng.serviceapi.facade.dto.UnitApplyPriceDTO;
import com.tsintergy.tmosguide.datamng.serviceapi.facade.dto.UnitPowerFcDTO;
import com.tsintergy.tmosguide.datamng.web.base.controller.request.datamng.QueryUnitApplyPriceRequest;
import com.tsintergy.tmosguide.datamng.web.base.controller.request.datamng.QueryUnitPowerFcRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

@Api(value = "数据管理", tags = "数据管理")
@RestController
@RequestMapping(DatamngConfigConstants.MAPPING_PREFIX)
public class DatamngController {

    @Autowired
    DatamngFacadeService datamngFacadeService;

    @ApiOperation("查询机组出力预测")
    @GetMapping("/queryUnitPowerFc")
    public BaseResp<List<UnitPowerFcDTO>> queryUnitPowerFc(QueryUnitPowerFcRequest request) {
        return BaseRespBuilder
                .success()
                .setData(datamngFacadeService.queryUnitPowerFcList(request.getUnitIdList(), request.getDate()))
                .build();
    }

    @ApiOperation("查询系统负荷预测")
    @GetMapping("/queryAreaLoadFc")
    public BaseResp<AreaLoadFcDTO> queryAreaLoadFc(Date date) {
        return BaseRespBuilder
                .success()
                .setData(datamngFacadeService.queryAreaLoadFcDTO(date), AreaLoadFcDTO.class)
                .build();
    }

    @ApiOperation("查询机组出力市场报价")
    @GetMapping("/queryUnitApplyPrice")
    public BaseResp<List<UnitApplyPriceDTO>> queryUnitApplyPrice(QueryUnitApplyPriceRequest request) {
        //TODO 仿照queryUnitPowerFc方法实现此功能
        return BaseRespBuilder
                .success()
                .setData(datamngFacadeService.queryUnitApplyPriceList(request.getUnitIdList(),request.getDate()))
                .build();
        //throw new UnsupportedOperationException("请实现queryUnitApplyPrice方法");
    }

}
